<template>
  <div class="container">
    <van-nav-bar fixed title="分类" />
    <van-grid :gutter="20" :column-num="2">
      <van-grid-item
        :to="'/list/'+item.id"
        :icon="item.icon.includes('fa-') ? item.icon.slice(3) : item.icon"
        icon-prefix="fa"
        :text="item.catename"
        v-for="item in allCate"
        :key="item.id"
      />
    </van-grid>
  </div>
</template>

<script>

export default {
  data () {
    return {
      allCate: []
    }
  },
  async created () {
   await this.$store.dispatch('cateAction')
    this.allCate = this.$store.state.allCate
  }
}
</script>

<style scoped lang="less">
.van-nav-bar {
  z-index: 999;
}
.van-grid {
  margin-top: 40px;
  font-size: 50px;
}
</style>